﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Gnosis.Babel;

namespace Gnosis.SQLite
{
    public abstract class Constraint
        : Expression
    {
        protected Constraint(ConstraintName name, string type)
            : this(name, type, new List<IExpression>())
        {
        }

        protected Constraint(ConstraintName name, string type, IExpression expression)
            : this(name, type, new List<IExpression> { expression })
        {
        }

        protected Constraint(ConstraintName name, string type, IList<IExpression> expressions)
            : base("CONSTRAINT")
        {
            AddChild(name);
            AddChild(new Literal(type));

            foreach (IExpression expression in expressions)
                AddChild(expression);
        }
    }
}
